<?php
/**
 * Created by PhpStorm.
 * User: 氓羽
 * Date: 2018-4-19
 * Time: 23:07
 */
class Demo{
    private static $_instance = null;

    private function __construct()
    {

    }
    private function __clone()
    {
        // TODO: Implement __clone() method.
    }


    public static function getInstance(){
        if(!(self::$_instance instanceof self)){
            self::$_instance = new Demo();
        }else{
            return self::$_instance;
        }
    }
}
$test1 = Demo::getInstance();
$test2 = Demo::getInstance();
$test3 = Demo::getInstance();
$test4 = Demo::getInstance();

var_dump($test1);
var_dump($test2);
var_dump($test3);
var_dump($test4);
